package com.social.controller;

import com.social.pojo.Result;
import com.social.pojo.Volunteering;
import com.social.service.VolunteerService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @className: VolunteerController
 * @description: TODO 类描述
 * @author: XiaoXu
 * @date: 2022/11/28 13:28
 **/
@Api(tags = "VolunteerController")
@RestController
@RequestMapping("/volunteer")
public class VolunteerController {

    @Resource
    private VolunteerService volunteerService;

    @PostMapping
    public Result insert(@RequestBody Volunteering volunteering){
        return volunteerService.insert(volunteering);
    }

    @GetMapping
    public Result getVolunteerById(Integer id){
        return volunteerService.getVolunteerById(id);
    }

    @PutMapping
    public Result modify(@RequestBody Volunteering volunteering){
        return volunteerService.modify(volunteering);
    }

    @GetMapping("/register/{id}")
    public Result register(@PathVariable("id") Long id){
        return volunteerService.register(id);
    }
}
